'''
$LastChangedBy: csgillespie $
$LastChangedDate: 2007-06-06 11:08:06 +0000 (Wed, 06 Jun 2007) $
Colin Gillespie <c.gillespie@ncl.ac.uk>
'''
from pysbml import pysbml

#Create an empty model - Can also edit a previous model
e = pysbml.SBMLModel()
e.setId('LV_Model')
e.setNotes('<body xmlns="http://www.w3.org/1999/xhtml">\
	This is the tradional LV model</body>')

e.add(Compartments = {'Id':'Cell'})
e.add(Species = {'Id':'X', 'InitialAmount':10, 'Compartment':'Cell'})
e.add(Species = {'Id':'Y', 'InitialAmount':10, 'Compartment':'Cell'})

e.add(Parameters = {'Id':'a', 'Value':1})
e.add(Parameters = {'Id':'b', 'Value':1})
e.add(Parameters = {'Id':'c', 'Value':1})

e.add(Reactions = {'Id':'PreyReproduction', 
	'listOfReactants':[{'Species':'X'}],
	'listOfProducts':[{'Species':'X','Stoichiometry':2}], 
	'KineticLaw':{'Formula':'X'}})
e.add(Reactions = {'Id':'PredatorReproduction', 
	'listOfReactants':[{'Species':'X'},{'Species':'Y'}],
	'listOfProducts':[{'Species':'Y','Stoichiometry':2}], 
	'KineticLaw':{'Formula':'b * X * Y'}})
e.add(Reactions = {'Id':'PredatorDecay', 'Reversible':0,
	'listOfReactants':[{'Species':'Y'}],
	'listOfProducts':[{'Species':'Y','Stoichiometry':1}],
	'KineticLaw':{'Formula':'c*Y'}})	

print 'Change the species names'
e.modify(Species={'X':{'Id':'Prey'}, 'Y':{'Id':'Pred'}})


print e.validate()
print e.sbml2mod()
print 'EOF'
